import request from "axios";

interface LoginData {
  username: string
  password: string
}
interface LoginForm {
  username: string
  password: string
}


interface LoginResponse {
  token: string
}

// 登录接口
export const login = (data: LoginForm) => {
  return request<LoginResponse>({
    url: 'http://localhost:8080/auth/login',
    method: 'post',
    data
  })
}
interface RegisterData {
  username: string
  password: string
}

export function register(data: RegisterData) {
  return request({
    url: 'http://localhost:8080/auth/register',
    method: 'post',
    data
  })
}